<!DOCTYPE html>
<html lang="en" >
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="author" content="GoJun" />
	
	
	
	<title>Jenkins 用户权限管理指南 ｜ GoJun</title>
	
    
    
    <meta name="description" content="新增用户 路径：Manage Jenkins &amp;ndash;》Manage User &amp;ndash;》Create User 安装权限管理插件 插件名称：Role-based Authorization Strategy 全局配置 路径：Manage Jenkins &amp;ndash;》Configure" />
    

    
    
    <meta name="keywords" content="Hugo, theme, zozo" />
    

	
    
    <link rel="shortcut icon" href="https://gojun.me/images/favicon.ico" />

    <link rel="stylesheet" type="text/css" media="screen" href="https://gojun.mecss/normalize.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.jsdelivr.net/npm/animate.css@4.1.0/animate.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="https://gojun.me/css/zozo.css" />
	<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="https://gojun.me/css/highlight.css" />

    
    
</head>

<body>
    <div class="main animate__animated animate__fadeInDown">
        <div class="nav_container animated fadeInDown">
    <div class="site_nav" id="site_nav">
        <ul>
            
            <li>
                <a href="/">Home</a>
            </li>
            
            <li>
                <a href="/posts/">Archive</a>
            </li>
            
            <li>
                <a href="/tags/">Tags</a>
            </li>
            
            <li>
                <a href="/projects/">Projects</a>
            </li>
            
        </ul>
    </div>
    <div class="menu_icon">
        <a id="menu_icon"><i class="ri-menu-line"></i></a>
    </div>
</div>
        <div class="header animated fadeInDown">
    <div class="site_title_container">
        <div class="site_title">
            <h1>
                <a href="https://gojun.me">
                    <span>GoJun</span>
                </a>
            </h1>
        </div>
        <div class="description">
            <p class="sub_title">为向往生活努力奋斗！</p>
            <div class="my_socials">
                
                
                <a href="https://github.com/freelander" title="github" target="_blank"><i class="ri-github-fill"></i></a>
                
                
                <a href="https://gojun.me/index.xml" type="application/rss+xml" title="rss" target="_blank"><i
                        class="ri-rss-fill"></i></a>
            </div>
        </div>
    </div>
</div>
        <div class="content">
            <div class="post_page">
                <div class="post animate__animated animate__fadeInDown">
                    <div class="post_title post_detail_title">
                        <h2><a href='/posts/jenkins-user-manage/'>Jenkins 用户权限管理指南</a></h2>
                        <span class="date">2021.09.11</span>
                    </div>
                    <div class="post_content markdown"><h3 id="新增用户">新增用户</h3>
<p>路径：Manage Jenkins &ndash;》Manage User &ndash;》Create User</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-01.png">
<img src="/images/2021/09/jenkins-user-manage-01.png" alt="img"  />
</a>
</div>

</p>
<h3 id="安装权限管理插件">安装权限管理插件</h3>
<p>插件名称：Role-based Authorization Strategy</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-02.png">
<img src="/images/2021/09/jenkins-user-manage-02.png" alt="img"  />
</a>
</div>

</p>
<h3 id="全局配置">全局配置</h3>
<p>路径：Manage Jenkins &ndash;》Configure Global Security &ndash;》Authorization</p>
<p>将授权策略更改为 Role-Based Strategy 选项，该选项是插件安装完成后才有的。</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-03.png">
<img src="/images/2021/09/jenkins-user-manage-03.png" alt="img"  />
</a>
</div>

</p>
<h3 id="管理角色">管理角色</h3>
<h4 id="全局角色">全局角色</h4>
<p>路径：Manage Jenkins &ndash;》Manage and Assign Roles &ndash;》Manage Roles</p>
<p>默认有个管理员，根据实际情况来创建不同角色，然后分配不同权限，值得注意的是创建的角色都要勾选上 <code>Overall Read</code> 权限，否则无法</p>
<p>比如我创建一个developer 角色，给予部分权限：</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-04.png">
<img src="/images/2021/09/jenkins-user-manage-04.png" alt="img"  />
</a>
</div>

</p>
<h4 id="项目角色">项目角色</h4>
<p>根据现有的项目进行分配，比如我这里创建了三个，用户分配到指定项目，那么他就只能操作指定项目。</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-05.png">
<img src="/images/2021/09/jenkins-user-manage-05.png" alt="img"  />
</a>
</div>

</p>
<p>项目匹配使用正则，比如我这里 <code>Kotlin.*</code>，匹配 Kotlin 开头的项目。</p>
<p>添加完之后可以点击匹配规则哪里，会弹起弹窗显示匹配到的项目。</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-08.png">
<img src="/images/2021/09/jenkins-user-manage-08.png" alt="img"  />
</a>
</div>

</p>
<h3 id="分配角色">分配角色</h3>
<p>对上面新创建的 Test User 用户进行权限配置：</p>
<p>分配 developer 权限：</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-06.png">
<img src="/images/2021/09/jenkins-user-manage-06.png" alt="img"  />
</a>
</div>

</p>
<p>分配到 Kotlin 项目：</p>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-07.png">
<img src="/images/2021/09/jenkins-user-manage-07.png" alt="img"  />
</a>
</div>

</p>
<h3 id="登录-testuser-账号确认">登录 TestUser 账号确认</h3>
<p>

<div class="fancybox">
<a data-fancybox="demo" href="/images/2021/09/jenkins-user-manage-09.png">
<img src="/images/2021/09/jenkins-user-manage-09.png" alt="img"  />
</a>
</div>

</p>
</div>
                    <div class="post_footer">
                        
                        <div class="meta">
                            <div class="info">
                                <span class="field tags">
                                    <i class="ri-stack-line"></i>
                                    
                                    <a href="https://gojun.me/tags/jenkins/">Jenkins</a>
                                    
                                </span>
                            </div>
                        </div>
                        
                    </div>
                </div>
                
                
                <div class="doc_comments"></div>
                
            </div>
        </div>
    </div>
    <a id="back_to_top" href="#" class="back_to_top"><i class="ri-arrow-up-s-line"></i></a>
    <footer class="footer">
    <div class="footer_slogan">
        <span></span>
    </div>
</footer>
    <script src="https://gojun.me/js/jquery-3.5.1.min.js"></script>
<link href="https://gojun.me/css/fancybox.min.css" rel="stylesheet">
<script src="https://gojun.me/js/fancybox.min.js"></script>
<script src="https://gojun.me/js/zozo.js"></script>


<script type="text/javascript" async
    src="https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
        MathJax.Hub.Config({
            tex2jax: {
                inlineMath: [['$', '$'], ['\\(', '\\)']],
                displayMath: [['$$', '$$'], ['\[\[', '\]\]']],
                processEscapes: true,
                processEnvironments: true,
                skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
                TeX: {
                    equationNumbers: { autoNumber: "AMS" },
                    extensions: ["AMSmath.js", "AMSsymbols.js"]
                }
            }
        });

        MathJax.Hub.Queue(function () {
            
            
            
            var all = MathJax.Hub.getAllJax(), i;
            for (i = 0; i < all.length; i += 1) {
                all[i].SourceElement().parentNode.className += ' has-jax';
            }
        });
    </script>

<style>
    code.has-jax {
        font: inherit;
        font-size: 100%;
        background: inherit;
        border: inherit;
        color: #515151;
    }
</style>



<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
	window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
	ga('create', 'UA-142037913-1', 'auto');
	
	ga('send', 'pageview');
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

</body>

</html>